\documentclass[main]{subfiles}
\begin{document}

The Rodrigues' formula are closed form expression of the function
$\omega \mapsto \exp\hat\omega,$ $\omega\in\real^3$ and its inverse.

% ------------------------------------------------------------------------------
\section{Direct Rodrigues' formua}\label{rodrigues.direct}
% ------------------------------------------------------------------------------

 For a proof of the consistency of the following definition see~\cite{ma03invitation}, pag. 27.

\begin{definition}[Rodrigues' formula]\label{def:rodrigues}
Let $\omega\in\real^3$. The {\em Rodrigues' formula} is the expression
\be\label{eq:rodrigues}
  \exp\hat\omega =
  I + \frac{\hat\omega}{\|\omega\|} \sin(\|\omega\|) +
  \frac{\hat\omega^2}{\|\omega\|^2} 
  \left[1 - \cos(\|\omega\|) \right]
\ee
which defines a parametrization $\real^3\rightarrow SO(3)$ of $SO(3)$.
\end{definition}

\begin{proposition}\label{prop:rodrigues}
The derivative of the Rodrigues' function (see Def.~\ref{def:rodrigues}) 
is given by
\be\label{eq:rodrigues-der}
\begin{split}
 \frac{\partial \vecop \exp\hat{\omega}}{\partial \omega^\top} 
& =
\left(
\sin\theta 
\frac{\partial\vecop \hat r}{\partial r^\top} +
(1-\cos(\theta)) 
\frac{\partial\vecop \hat r^2}{\partial r^\top}
\right)
\frac{I - r r^\top}{\theta}
\\
& +
\left(
(\vecop \hat r) \cos \theta + (\vecop \hat r^2) \sin \theta
\right)
r^\top
\end{split}
\ee
where $\omega\in\real^3$.
\end{proposition}
\begin{proof}
In order to carry the computation, it is conviente to define $\theta=\|\omega\|$ and $r=\omega/\theta$ and consider the function
\[
  \psi(r,\theta) \defeq
  \vecop\left( I + \hat r \sin \theta + \hat r^2 (1-\cos\theta) \right).
\]
Then
\[
 \frac{\partial \vecop \exp\hat{\omega}}{\partial \omega^\top} 
 =
 \frac{\partial\psi}
{\partial r^\top} \frac{\partial r}{\partial \omega^\top}
+
\frac{\partial\psi}
{\partial \theta}
\frac{\partial \theta}{\partial \omega^\top}
\]
where
\[
\frac{\partial\psi}
{\partial r^\top} =
\sin\theta 
\frac{\partial\vecop \hat r}{\partial r^\top} +
(1-\cos(\theta)) 
\frac{\partial\vecop \hat r^2}{\partial r^\top},
%%
\qquad
%%
\frac{\partial\psi}
{\partial \theta} =
(\vecop \hat r) \cos \theta + (\vecop \hat r^2) \sin \theta.
\]
and
\[
\frac{\partial \theta}{\partial \omega^\top}
=
\frac{\partial \|\omega\|}{\partial \omega^\top} = \frac{\omega^\top}{\|\omega\|}
= r^\top.
\]
To compute $\partial r / \partial \omega^\top$, indicate with $dr(dw)$ the variation of $r$ given by a variation $dw$ of $w$. We have (exactly)
\[
dr(dw) = 
\frac{\partial \omega}{\partial \omega^\top} d\omega \frac{1}{\theta}
+
\omega \frac{-1}{\theta^2} 
r^\top d\omega
= \frac{1}{\theta}(I - r r^\top) d\omega
\]
so that, by definition of differential of $r(w)$ and since this is equal to $\partial r / \partial \omega^\top$, we get
\[
\frac{\partial r}{\partial \omega^\top}
= \frac{1}{\theta}(I - r r^\top).
\]
\end{proof}

\begin{corollary}
An expression equivalent to~\eqref{eq:rodrigues-der} is
\[
\begin{split}
 \frac{\partial \vecop \exp\hat{\omega}}{\partial \omega^\top} 
& =
\left(
\frac{\sin\theta}{\theta}
\frac{\partial\vecop \hat r}{\partial r^\top} +
\frac{1-\cos(\theta)}{\theta}
\frac{\partial\vecop \hat r^2}{\partial r^\top}
\right)
\\
& +
\left(
 \left(\cos \theta - \frac{\sin\theta}{\theta}\right)
    \vecop \hat r  
 + 
\left(\sin \theta - 2\frac{1-\cos\theta}{\theta}\
\right)
\vecop \hat r^2
\right)
r^\top.
\end{split}
\]
\end{corollary}

\begin{proof}
Note that $(\partial \vecop \hat r / \partial r^\top) r = \hat r$ and that
$(\partial \vecop \hat r^2 /\partial r^\top) r = 2\hat r^2$.
\end{proof}

% ------------------------------------------------------------------------------
\section{Inverse Rodrigues' formula}
% ------------------------------------------------------------------------------

We come now to the computation of the inverse Rodrigues' formula, also referred as ``principal logarithm of $SO(3)$'' in~\cite{ma03invitation}. Obviously, for any rotation $R\in SO(3)$ there are infinite vectors $\omega$ such that
$\exp\hat\omega = R$ (they are parallel and their moduli differ by $k\pi$).
The principal logarithm finds the unique solution $\omega$ such that
$\|\omega\|\in[0,\pi[$ (the case $\|\omega\|=\pi$ is singular).

\begin{proposition}[Inverse Rodrigues' formulas]\label{prop:inv-rodrigues}
For any $R\in SO(3)$ there exists at least one $\omega\in\real^3$ such that
$\exp\hat\omega=R$. One of such $\omega$ is given by the {\em inverse Rodrigues' formulas}
\be\label{eq:inv-rodrigues}
  \theta = \cos^{-1}
  \left(
  \frac{\tr R -1}{2}    
  \right),
  \qquad
   r =
   \bM
   r_1 \\ r_2 \\ r_3
   \eM
   =
   \frac{1}{2\sin\theta}
   \bM
   	  R_{32} - R_{23} \\
	  R_{13} - R_{31} \\
	  R_{21} - R_{12} \\
   \eM,
   \qquad
   \omega = \theta r
\ee
which define a function $SO(3)\rightarrow \real^3$ which we indicate with
$\Log_{SO(3)}(\omega)$. The case $\theta = \pm\pi$ is singular; here one can use the formula
\be\label{eq:inv-rodrigues-plus}
  \hat{r}^2 = \frac{1}{1-\cos\theta}
  \left[ \frac{R+R^\top}{2} - I \right]
\ee
and extract $r$ as the null eigenvector of this matrix.
\end{proposition}
\begin{proof}
By applying the trace operator to the Rodrigues' formula~\eqref{eq:rodrigues}, we get
\[
\tr R = 
\tr \exp\hat\omega =
3 + \tr(\hat{r})\sin\theta + \tr(\hat{r}^2) (1-\cos\theta)
\]
The matrix $\hat{r}$ has a null eigenvalue because $\hat{r}r=r\times r=0$. Moreover, there exists two orthogonal vectors $v_1,v_2$ such that $\hat{r}v_1 = \lambda v_2$ and $\hat{r}v_2 = -\lambda v_1$. As such $\hat{r}(v_1+iv_2)=\lambda(v_2-iv_1)=-\lambda i(v_1+iv_2)$ and $\hat{r}(iv_1+v_2)=\lambda(iv_2-v_1)=+\lambda i(iv_1+v_2)$. Thus the other two eigenvalues are $\pm\lambda i$ and we have $\tr(\hat{r})=0$. Since (as can be easily verified using the properties of the cross product) $\hat{r}\hat{r}\hat{r} = - \hat{r}$, the matrix $\hat{r}^2$ has a null eigenvalue (because $\hat{r}^2r=\hat{r}(r\times r)=0$) and acts on the range of $\hat{r}$ as a reflection. Hence the other two eigenvalues are $-1$ and $\tr\hat{r}^2 = 0 -1 -1 = -2$. This gives the formula for $\theta$.

To compute the vector $r$, we note that $\hat{r}^\top = - \hat{r}$ is an anti-symmetric matrix and that $\hat{r}^2 = \hat{r}^{2,\top}$ is symmetric. Thus, by using the Rodrigues' formula, transposing and subtracting, we get
$
 R - R^\top = 2 \sin\theta \hat{r}.
$
Eventually we get the formula for $r$ by using the expression of the hat operator $\hat{\cdot}$. The last formula~\eqref{eq:inv-rodrigues-plus} is obtained in a similar way.
\end{proof}

We now compute the derivative of the inverse Rodrigues' function $\Log_{SO(3)}(\omega)$. In order to compute this derivative we need to be careful, as the function is defined on $SO(3)$. We start by noting that the formulas~\eqref{eq:inv-rodrigues} are actually defined on a broader space of matrices, and in particular on a neighbor of $SO(3)$ embedded in $GL(3)$. In addition, with the exception of the singular cases $\|\omega\| \in \pi\integer,$ those formulas are smooth in such neighbor. As such it {\em does} make sense to derive $w$ on $GL(3)$ instead of $SO(3)$, as we do in the following proposition.

\begin{proposition}
The function $Log_{SO(3)}$ can be extended, by using the formulas of Prop.~\ref{prop:inv-rodrigues}, to a function $\theta r:U\rightarrow \real^3$ where $U$ is a neighbor of $SO(3)$ embedded in $GL(3)$. The function is smooth in $U$ with the exception of the singular points $\theta\in\pi\integer$. The derivative of such function is given by
\be\label{eq:inv-rodrigues-der}
\frac{\partial(\theta r)}{\partial R_{ii}}
=
\frac{\theta\cos\theta-\sin\theta}{2(\sin\theta)^2}r_i,
\qquad
\frac{\partial (\theta r)}{\partial R_{ij}}
=
\frac{\theta}
{2 \sin \theta}
\bM
\delta_{i3}\delta_{j2} - \delta_{i2}\delta_{j3} \\
\delta_{i1}\delta_{j3} - \delta_{i3}\delta_{j1} \\
\delta_{i2}\delta_{j1} - \delta_{i1}\delta_{j2} \\
\eM,\quad i\not=j.
\ee
\end{proposition}
\begin{proof}
Just derive~\eqref{eq:inv-rodrigues} by elementary means.
\end{proof}

This proposition is useful because the formula~\eqref{eq:inv-rodrigues-der} of the derivative is simple. Nevertheless, the function $\theta r:U\rightarrow \real^3$ there defined has a meaning only restricted to $SO(3)$, where it coincides with $\Log_{SO(3)}$. When we ``derive'' $\Log_{SO(3)}$, we are actually looking for its push-forward, that is for a linear map from the tangent space $T_{R}(SO(3))$ to $\real^3$. This push-forward can be computed, because of the smoothness, from \ref{eq:inv-rodrigues-der} by means of any base of $T_R(SO(3))$. One way to  get such a base for $R=I$ is to compute (by means of eq.~\eqref{eq:rodrigues-der})
$
   {\partial \vecop \exp\hat \omega}/{\partial \omega ^\top}(0),
$
which gives
\[
  T_{I}(SO(3)) = 
  \left<
\bM
0 & 0 & 0 \\
0 & 0 & -1 \\
0 & 1 & 0 \\
\eM,
\ %
\bM
0  & 0 & 1 \\
0  & 0 & 0 \\
-1 & 0 & 0 \\
\eM,
\ %
\bM
0 & -1 & 0 \\
1 &  0 & 0 \\
0 &  0 & 0 \\
\eM
\ %
\right> =
\left<
E_1, E_2, E_3
\right>.
\]
A basis for the tangent space $T_R(SO(3))$ at $R\in SO(3)$ can be obtained by rotating the above basis, i.e. as
$
T_R(SO(3)) = R \left< E_1,\ E_2,\ E_3 \right>.
$
The derivative of the inverse Rodrigues' formula~\eqref{eq:inv-rodrigues-der} can now be correctly interpreted as the linear mapping (push-forward)
$T_R(SO(3)) \rightarrow \real^3$ given by
\[
 \bM \omega_1 \\ \omega_2 \\ \omega_3
 \eM
 \longmapsto
 \frac{\partial (\theta r)}{\partial \vecop R^\top}
 \bM
   \vecop E_1 & \vecop E_2 & \vecop E_3
 \eM
 \bM \omega_1 \\ \omega_2 \\ \omega_3 \eM.
\]
Note that in the last equation $\omega \in T_R(SO(3))$; note also that
any other basis of $T_R(SO(3))$ can be used instead of 
$R\left< E_1,E_2,E_3\right>$.

\begin{remark}[When formula~\eqref{eq:inv-rodrigues-der} can be used]
As we saw, formula~\eqref{eq:inv-rodrigues-der} has a meaning only when restricted to $SO(3)$ because the inverse Rodrigues' formula is defined there. 
When applying the chain rule, it is generally safe to use the formula as it is.
\end{remark}

\end{document}
